using System;
using System.Linq;
using Mono.Cecil;
using UnityEngine;

[Serializable]
public class LevelTable
{
	[Serializable]
	public class CameraSettings
	{
		[SerializeField]
		private int version;

		[SerializeField]
		private float proximityFactor;

		[SerializeField]
		private float proximityPower;

		[SerializeField]
		private float zoomInSpeed;

		[SerializeField]
		private float zoomOutSpeed;

		[SerializeField]
		private Vector3 proximityVector;

		public int Version => 0;

		public float ProximityFactor => 0f;

		public float ProximityPower => 0f;

		public Vector3 ProximityVector => default(Vector3);

		public float ZoomInSpeed => 0f;

		public float ZoomOutSpeed => 0f;
	}

	[Serializable]
	public class HitStopSettings
	{
		[SerializeField]
		private float impaleFactor;

		[SerializeField]
		private float cutFactor;

		[SerializeField]
		private float killFactor;

		[SerializeField]
		private float lastKillFactor;

		[SerializeField]
		private float decay;

		[SerializeField]
		private float delay;

		[SerializeField]
		private float minSlowScale;

		[SerializeField]
		private float monochromeStrength;

		[SerializeField]
		private bool adaptiveTimeScaleEnabled;

		public float ImpaleFactor => 0f;

		public float CutFactor => 0f;

		public float KillFactor => 0f;

		public float LastKillFactor => 0f;

		public float Decay => 0f;

		public float Delay => 0f;

		public float MinSlowScale => 0f;

		public float MonochromeStrength => 0f;

		public bool AdaptiveTimeScaleEnabled => false;
	}

	[Serializable]
	private class LightingData
	{
		[SerializeField]
		private string lightingSceneName;

		[SerializeField]
		private int levelCount;

		public string LightingSceneName => null;

		public int LevelCount => 0;
	}

	[Serializable]
	public class ColorSettings
	{
		[SerializeField]
		private string materialSetName;

		[SerializeField]
		private LightingData[] lightings;

		public string MaterialSetName => null;

		public string GetLightingSceneName(int levelIndex)
		{
			return null;
		}
	}

	[Serializable]
	private class BulletData
	{
		[SerializeField]
		private string prefabName;

		[SerializeField]
		public double cost;

		public string PrefabName => null;

		public double Cost => 0.0;
		public string GetName()
		{
			return prefabName;
		}
	}

	[SerializeField]
	private BulletData[] bullets;

	[SerializeField]
	private string rootPath;

	[SerializeField]
	private int failMessageVersion;

	[SerializeField]
	private float clearWait;

	[SerializeField]
	private float failWait;

	[SerializeField]
	private int targetingVersion;

	[SerializeField]
	private bool targetCursorEnabled;

	[SerializeField]
	private int soundVersion;

	[SerializeField]
	private int landDetectorVersion;

	[SerializeField]
	private int drawingEffectVersion;

	[SerializeField]
	private bool fixShockRecoveryBug;

	[SerializeField]
	private int controlVersion;

	[SerializeField]
	private bool headIsLethal;

	[SerializeField]
	private int failureVersion;

	[SerializeField]
	private float fireInputCurveThreshold;

	[SerializeField]
	private float maxFireCurve;

	[SerializeField]
	private float hpMultiplier;

	[SerializeField]
	private bool bakeScale;

	[SerializeField]
	private HitStopSettings hitStop;

	[SerializeField]
	private string[] levelNames;

	[SerializeField]
	private ColorSettings colorSettings;

	[SerializeField]
	private CameraSettings camera;

	private const string DefaultBulletPrefabName = "Shuriken_0";

	public int Count => 0;

	public int LevelEndVersion => 0;

	public int TargetingVersion => 0;

	public float ClearWait => 0f;

	public float FailWait => 0f;

	public bool TargetCursorEnabled => false;

	public int SoundVersion => 0;

	public int DrawingEffectVersion => 0;

	public string MaterialSetName => null;

	public float FireInputCurveThreshold => 0f;

	public bool BakeScale => false;

	public Level.Settings CreateLevelSettings()
	{
		Level.Settings newSetting = new Level.Settings(
			maxFireCurve,
			landDetectorVersion,
			fixShockRecoveryBug,
			failureVersion,
			headIsLethal,
			controlVersion,
			hpMultiplier,
			targetingVersion
		);
		return newSetting;
	}

	public string GetLevelPath(int index)
	{
		if (levelNames != null)
			return levelNames[index % levelNames.Length];
		else
			Debug.LogError("关卡数据为空");
		return null;
	}

	public string GetLightingSceneName(int levelIndex)
	{
		return null;
	}

	public static LevelTable Load(string name)
	{
		return null;
	}

	public BulletBase LoadBulletPrefab(string bulletName)
	{
		BulletBase bulletBase = null;
		foreach (BulletData bulletData in bullets)
		{
			if (bulletName.Equals(bulletData.PrefabName))
			{
				bulletBase = ResourceManager.Instance.LoadComponentFromPrefab<BulletBase>("bullets/" + bulletName);
				return bulletBase;
			}
		}
		bulletBase = ResourceManager.Instance.LoadComponentFromPrefab<BulletBase>("bullets/" + DefaultBulletPrefabName);
		return bulletBase;
	}

	public Level LoadPrefab(int index)
	{
		Level level = ResourceManager.Instance.LoadComponentFromPrefab<Level>("levels/" + levelNames[index % levelNames.Length]);
		if (level == null)
		{
			Debug.LogError("加载关卡失败");
		}
		return level;
	}

	public Level Instantiate(Level prefab, Transform parent)
	{
		return GameObject.Instantiate<Level>(prefab, parent);
	}

	public Level Instantiate(int index, Transform parent)
	{
		return GameObject.Instantiate<Level>(LoadPrefab(index), parent);
	}

	public CameraSettings GetCameraSettings()
	{
		return null;
	}
	public ColorSettings GetColorSettings()
	{
		return colorSettings;
	}
	public HitStopSettings GetHitStopSettings()
	{
		return null;
	}

	private int FindBullet(string bulletName)
	{
		return 0;
	}

	private int NormalizeLevelIndex(int index)
	{
		return 0;
	}
	public string GetBulletPrefabName()
	{
		return bullets[0].GetName();
	}
}
